import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../components/Home.vue'
// import Home from '../views/Home.vue'
// -----------------   用户管理  ------------------
import UserListPage from "../components/pages/UserListPage";  //用户列表
import StudentManagerPage from "../components/pages/StudentManagerPage";  //学生管理
import TeacherManagerPage from "../components/pages/TeacherManagerPage";  //教师管理
// ----------------    订单管理  -------------------
import OrderListPage from "../components/pages/OrderListPage";  //订单列表
import OrderManagerPage from "../components/pages/OrderManagerPage";  //订单管理
import OrderStatusPage from "../components/pages/OrderStatusPage";  //订单状态
// -----------------    权限管理    ------------------
import PagePowerPage from "../components/pages/PagePowerPage"  //页面权限
import CommandPowerPage from "../components/pages/CommandPowerPage"  //指令权限
import RolePowerPage from "../components/pages/RolePowerPage"  //角色权限

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect:'/userlist',
    meta:{
      keepalive:true          // 是否需要被缓存
    },
    children:[
      {
        path:'/userlist',
        name:'UserListPage',
        component: UserListPage,
        meta:{
          keepalive:true,
          // 设置面包屑导航
          breadcrumb:['用户管理','用户列表']
        }
      },
      {
        path:'/studentmanager',
        name:'StudentManagerPage',
        component: StudentManagerPage,
        meta:{
          keepalive:true,
          breadcrumb:['用户管理','学生管理'],
        }
      },
      {
        path:'/teachermanager',
        name:'TeacherManagerPage',
        component:TeacherManagerPage,
        meta:{
          keepalive:true,
          breadcrumb:['用户管理','教师管理'],
        }
      },
      {
        path:'/orderlist',
        name:'订单列表',
        component: OrderListPage,
        meta:{
          keepalive: true,
          breadcrumb:['订单管理','订单列表'],
        }
      },
      {
        path:'/orderstatus',
        name:'订单状态',
        component: OrderStatusPage,
        meta:{
          keepalive:true,
          breadcrumb:['订单管理','订单状态'],
        }
      },
      {
        path:'/ordermanager',
        name:'订单管理',
        component: OrderManagerPage,
        meta:{
          keepalive:true,
          breadcrumb:['订单管理','订单管理'],
        }
      },
      {
        path:'/pagepower',
        name:'页面权限',
        component: PagePowerPage,
        meta:{
          keepalive:true,
          breadcrumb:['权限测试','页面权限'],
        }
      },
      {
        path:'/commandpower',
        name:'指令权限',
        component: CommandPowerPage,
        meta:{
          keepalive:true,
          breadcrumb:['权限测试','指令权限'],
        }
      },
      {
        path:'/rolepower',
        name:'角色权限',
        component: RolePowerPage,
        meta:{
          keepalive:true,
          breadcrumb:['权限测试','角色权限'],
        }
      },
    ]
  },


 

  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  },

]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
